package com.tong.embeddedvr.controller;

import com.tong.embeddedvr.service.impl.StatisticServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@CrossOrigin
@RestController
@RequestMapping("/statistic")
public class StatisticController {

    @Autowired
    private StatisticServiceImpl statisticService;

    @RequestMapping("/getall")
    public String getAll(HttpSession httpSession){
        return statisticService.getAll();
    }

    @RequestMapping("/download")
    public void download(HttpSession httpSession){
        statisticService.addCount("download");
    }

    @RequestMapping("/operating")
    public void operating(HttpSession httpSession){
        statisticService.addCount("operating");
    }
}
